package com.itrus.auth.demo.company.bank;

import com.itrus.auth.demo.core.BaseAuth;
import com.itrus.auth.demo.core.Config;
import lombok.extern.slf4j.Slf4j;

import java.util.Map;
import java.util.TreeMap;

/**
 * @author : peigen
 * @since: 2023/8/1 16:59
 */
@Slf4j
public class BankQueryAuth extends BaseAuth {

    private String SERVICE_CODE = "idb0041";
    private String REQUEST_PATH = "/enterprise/payment/queryIdenNewPay";

    public BankQueryAuth(Config config) {
        super.config = config;
    }

    @Override
    public String getServiceCode() {
        return SERVICE_CODE;
    }


    /**
     * 验证银行打款
     *
     * @param orderNumber 企业打款返回的流水号
     */
    public void query(String orderNumber) {
        Map<String, String> requestMap = new TreeMap();
        requestMap.put("appId", config.getAppId());
        requestMap.put("orderNumber", orderNumber);

        // 申请银行打款
        doRequest(REQUEST_PATH, requestMap);
    }
}
